<?php
function getCJ($params)
{
$devKey = '****';
$siteKey = '3584291'; // the siteID for the site you are running the script on
$advertiserIds = '10522161'; // e.g., I think these are Buy.com USA and CA and SHOP.com - the script will only search on these advertisers, since you don't want to market products from advertisers you don't have a relationship with, right?
$currency = 'USD';
$ParamArray = array('developerKey' => $devKey, 'websiteId' => $siteKey, 'advertiserIds' => $advertiserIds, 'currency' => $currency); // parameters I will include in all my calls

// some optional parameters

if ($params ['keywords']) 
{
          $ParamArray ['keywords'] = $params ['keywords']; 
}

if ($params ['upc'])
{


          $ParamArray['upc'] = "00".$params ['upc'];

}
}
// end of optional parameters - you might not want to specify UPC or keywords

$client = new
   SoapClient ("https://product.api.cj.com/wsdl/version2/productSearchServiceV2.wsdl"); // oh, you need to be running PHP5 to use these SOAP functions 
$results = $client->search($ParamArray); // creates an object from the API call, hope you are OK with objects, I'm a bit hazy :)
return $results;
?>
<?php
foreach ($data->out->products->Product as $Product)
{

$advertiserName = (string)$Product->advertiserName;
$buyUrl = (string)$Product->buyUrl;
} // NOT complete code, just an example!
?>
<?php
echo getCJ(array('keywords' => 'ipod')); 
// call the getCJ function with parameters as an array - possible parameters are  'upc' => 'UPC CODE OF PRODUCT' or 'keywords' => 'SEARCH TERMS'

?>